package web.sso.common.collections;

import web.sso.common.throwable.ConstructorNotAvailableError;

import java.util.Collection;

/**
 * DATE: 2020/1/27
 * TIME: 8:29 下午
 * AUTHOR: hlm
 */
public class Collections {

    protected Collections() {
        throw new ConstructorNotAvailableError(Collections.class);
    }

    /**
     * 判断集合是否非空
     * @param collection
     * @param <T>
     * @return
     */
    public static <T> boolean notEmpty(Collection<T> collection) {
        return collection != null && (!collection.isEmpty());
    }

    /**
     * 判断集合是否为空
     * @param collection
     * @param <T>
     * @return
     */
    public static <T> boolean isEmpty(Collection<T> collection) {
        return !notEmpty(collection);
    }
}
